<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>">
		<!--[if lte IE 6]></base><![endif]-->
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		
		<title>广东科学技术职业学院考生报到系统<s:property value="%{#session.college.collegesName}"/></title>

		<link href="css/pagecss.css" rel="stylesheet" type="text/css" />
		<script src="js/jquery-1.5.js" language="javascript">
</script>
		<link href="css/newindex.css" rel="stylesheet" type="text/css" />

		<script src="js/newpublic.js" language="javascript">
</script>
		<script src="js/table.js" language="javascript">
</script>
		<script src="js/pageInfo.js" type="text/javascript">
</script>
	<script src="js/jquery-ui-1.8.5.custom.min.js" language="javascript">
</script>
		<script language="javascript">
var list;
var result,stu_profName,stu_isRegister,stu_sex,stu_subjectsName,pay_operate,pay_temp,orderType,stu_clazz;
var flag,pageIndex,pageSize;
function zhuanf(ob) {
	var temp = $('#op4').val()
	if (temp != '') {
		$(".zhtext").css('display', 'block');
	} else {
		$(".zhtext").css('display', 'none');
		$(".zhtext").val("")
	}
}
$(function() {
	$("#content").draggable({cancel:".contable"});
//动态加载logo
	$("#content .subjectlogo").css("background-image","url(<%=basePath%>/newimages/${sessionScope.college.collegeLogo})");
	
	flag = 1;
	$("input[name='radio'][value=1]").attr("checked",true);  
	$("#content").draggable();
	$('#op1').get(0).selectedIndex = 0;
	$('#op2').get(0).selectedIndex = 0;
	$('#op3').get(0).selectedIndex = 0;
	$('#op4').get(0).selectedIndex = 0;
	$('#stu_register').get(0).selectedIndex = 0;
	$('#stu_sex').get(0).selectedIndex = 0;
	//专业列表
	list = '<s:property value="proJson" escape="false"/>';
	//学生类型列表
	subList = '<s:property value="subJson" escape="false"/>';
	//转换为对象
	list = eval("(" + list + ")");
	subList = eval("(" + subList + ")");
	for ( var a in list) {
		var temp = eval("list." + a);
		$("#op1").append("<option>" + a + "</option>");
		$('#op1').change(function() {
			if (this.options.selectedIndex == 0) {
				$('#op2').empty();
				$("#op2").append("<option value=''>全部班级</option>");
			} else
				show($(this.options[this.options.selectedIndex]).val());
		})
	}
	for ( var i = 0; i < subList.length; i++) {
		$('#op3').append("<option>" + subList[i] + "</option>");
	}
	$('#stuSearch').unbind("click").bind('click', function() {
	
		pay_temp=$('#stu_payment').val();
		
		p=/^\d{1,5}\d*$/
		if(pay_temp!=""&&!p.test(pay_temp)){
			alert("欠费格式不正确")
			return;
		}
		var index = <s:property value="pageInfo.pageIndex"/>;
		var size = <s:property value="pageInfo.pageSize"/>;
		
		$("#progressBar").show();
		$("#searchResult").hide();
		stu_profName=$('#op1').val();
		stu_clazz=$('#op2').val();
		stu_isRegister= $('#stu_register').val();
		stu_sex= $('#stu_sex').val();
		stu_subjectsName= $('#op3').val();
		pay_operate=$('#op4').val();
		orderType=$('#orderType').val();
		
		ajaxSubmit(index, size);
		
		
	});
	
	
})
function show(obj) {
	var temp = eval("list." + obj);
	$('#op2').empty();
	$("#op2").append("<option value=''>全部班级</option>");
	for ( var i = 1; i <= parseInt(temp); i++) {
		$("#op2").append("<option>" + i + "</option>");
	}
}

//显示查询结果
function showResult(data) {
	result = eval("(" + data.stuJson + ")");
	if (result.length <= 0){
		$("#queryResult").html("没有查到符合条件的同学!")
		$("#progressBar").hide();
	}else
		$("#queryResult").html("查询结果：")
	clearMessage();
	for ( var i = 0; i < result.length; i++) {
		$("#progressBar").hide();
		$("#searchResult").show();
		var sex = (result[i].sex == true ? '男' : '女');
		var name = result[i].studentName;
		var studentNumber = result[i].studentNumber;
		var examcode = result[i].examCode;
		var clazz = result[i].profession + result[i].clazz + "班";
		var area = result[i].area;
		var score = result[i].score;
		var register = (result[i].isRegister == true ? '是' : '否');
		var unpaidFees = result[i].unpaidFees>0?"<font color='red'>"+result[i].unpaidFees + ' 元</font>':result[i].unpaidFees+" 元";
		var subject = result[i].subject;
		var dorm = result[i].dormNumber;
		var idCode=result[i].idCode;
		var fee=result[i].feePayable;//学费
		var tr;
			if(i%2!=0){
				tr = '<tr style="background-color:#deefff" name="showStudentMessage">';
			} else {
				tr = '<tr style="background-color:#ffffff" name="showStudentMessage">';
			}
		tr += '<td  height="20" align="center">' + (i+1)
				+ '</td><td  height="20" align="center">' + name
				+ '</td><td  height="20" align="center">' + sex
				+ '</td><td  height="20" align="center">'
				+ studentNumber + '</td><td  height="20" align="center">'
				+ examcode + '</td><td  height="20" align="center">'
				+ idCode + '</td><td  height="20" align="center">'
				+ clazz + '</td><td  height="20" align="center">'
				+ area + '</td><td  height="20" align="center">'
				+ score + '</td><td  height="20" align="center">'
				+ register + '</td><td  height="20" align="center">'
				+ fee + '</td><td  height="20" align="center">'
				+ unpaidFees + '</td><td  height="20" align="center">'
				+ subject + '</td><td  height="20" align="center">'
				+ dorm + '</td></tr>';
		$("#infoTable").append($(tr));
	}

}
//清除数据
function clearMessage() {
	$("tr[name='showStudentMessage']").remove();
	
}

function ajaxSubmit(index, size) {
	pageIndex = index;
	pageSize = size;
	$.post("json/queryAction!queryAllStu", {
		"pageInfo.pageIndex" : index,
		"pageInfo.pageSize" : size,
		"stu_profName" : stu_profName,
		"stu_clazz" : stu_clazz,
		"stu_isRegister" : stu_isRegister,
		"stu_sex" :stu_sex,
		"stu_subjectsName" : stu_subjectsName,
		"pay_operate" : pay_operate,
		"pay_temp" : pay_temp,
		"orderType":orderType
	}, function(data) {
		var page = eval('(' + data.pageJson + ')');
		if(!page){
			alert("出错了！请重试")
			return;
		}
		initPage(page.totalPage, page.pageIndex, page.pageSize, page.totalRec);
		showResult(data);
		});
}
function setFlag(s){
	flag = s;
}
function exportDormExcel() {
	
		var url = 'exportComplexQueryExcel.action?flag=' +flag+ '&stu_profName=' + stu_profName + '&stu_clazz=' +stu_clazz+'&stu_isRegister='+stu_isRegister + '&stu_sex=' +stu_sex+ '&stu_subjectsName=' + stu_subjectsName + '&pay_operate=' +pay_operate+ '&pay_temp='+pay_temp + '&index=' + pageIndex + '&pageSize='+ pageSize+"&orderType="+orderType;
		$("#export_excel_form").attr("action",url).submit();
	}
</script>

	</head>
	<body onload="fixPNGAll()">
		<jsp:include page="common_head.jsp" />
		<div id="content">
			<!--当前位置CSS-->
			<div class="top">
				<div class="topleft">
					<div class="dan">
						<div>
							当前位置> 信息查询>综合查询
						</div>
					</div>
					<div class="F5">
						<img src="newimages/F5.png" />
					</div>
				</div>
				<div class="topright">
					<div class="toprightmin"></div>
					<div class="toprightmax"></div>
					<div class="toprightclose" onclick="if(confirm('是否确定退出！')){location.replace('loginoutAction')}" title="点击退出"></div>
				</div>
			</div>
			<!---->
			<!--内容-->
			<div class="condiv">
				<div class="subjectlogo">
					<!--每学院Logo-->
					<div class="submenu">
						<ul>
							<li>
								<a href="queryAction!obtainAllData">综合查询</a>
							</li>
							<li>
								<a href="queryClassAction">班级查询</a>
							</li>
						</ul>
					</div>
					<div class="contable">
						<div class="contable">
							<div class="title">
								综合查询
							</div>
							<!-- 表格从后台读取数据 -->
							<div class="selecontent">
							<table width="800" border="0" align="center" cellpadding="0"	cellspacing="10">
									<tr>
										<td width="62" align="right">
											专业：
										</td>
										<td width="125" align="left">
											<select id="op1" name="stu_profName">
												<option value="">
													全部专业
												</option>
											</select>
										</td>
										<td width="69" align="right">
											班级：
										</td>
										<td width="134" align="left">
											<select id="op2" name="stu_clazz">
												<option value="">
													全部班级
												</option>

											</select>
										</td>
										<td width="140" align="right">
											是否报到：
										</td>
										<td width="170" align="left">
											<select id="stu_register" name="stu_isRegister">
												<option value="">
													全部
												</option>
												<option value="yes">
													是
												</option>
												<option value="no">
													否
												</option>
											</select>
										</td>
										<td align="right"  width="149">排序方式：</td>
										<td align="left">
											<select  id="orderType">
												<option value="">无</option>
												<option value="dormNumber">宿舍</option>												
												<option value="clazz">班级</option>
												<option value="studentNumber">班内序号</option>
												<option value="subject">科目</option>											
												<option value="examCode">准考证</option>
												<option value="score">高考分数</option>
												<option value="register">是否报到</option>
												<option value="unpaidFees">欠费金额</option>
											</select>
										</td>
									</tr>
									<tr>
										<td align="right">
											性别：
										</td>
										<td align="left">
											<select id="stu_sex" name="stu_sex">
												<option value="">
													全部
												</option>
												<option value="male">
													男
												</option>
												<option value="female">
													女
												</option>
											</select>
										</td>
										<td align="right">
											科目：
										</td>
										<td align="left">
											<select name="stu_subjectsName" id="op3">
												<option value="">
													全部
												</option>
											</select>
										</td>
										<td align="right">
											欠费金额：
										</td>
										<td align="left">
											<table>
												<tr>
													<td>
														<select onchange="zhuanf(this)" id="op4"
															name="pay_operate">
															<option value="">
																全部
															</option>
															<option value="&gt">
																大于
															</option>
															<option value="=">
																等于
															</option>
															<option value="&lt">
																小于
															</option>
														</select>
													</td>
													<td>
														<input id="stu_payment" type="text" size="4"
															name="pay_temp" style="display: none;" class="zhtext" />
													</td>
												</tr>
											</table>
										</td>
										<td colspan="3" align="center">
											<input type="submit" id="stuSearch" value="查找"/>
										</td>
									</tr>
								</table>
							</div>
							<div id="progressBar" style="display:none">
									<!-- 进度圈 -->
									<center>
										<img src="images/loading.gif" /><br/>
										<font color="red">正在查询，请稍等。。。</font>
									</center>
								</div>
								<span style="color: #F00; font-size: 16px;" id="queryResult"></span>
							<div id="searchResult" style="display: none;">
								<Div id="data">
									<table width="100%" border="0" align="center" cellpadding="1"
										cellspacing="1" class="t1" style="border: 1px solid #5cb0ff;"
										id="infoTable">

										<tr>
											<th height="20" align="center">
												序号
											</th>
											<th height="20" align="center">
												姓名
											</th>
											<th height="20" align="center">
												性别
											</th>
											<th height="20" align="center">
												班内序号
											</th>
											<th height="20" align="center">
												准考证号
											</th>
											<th height="20" align="center">
												身份证
											</th>
											<th height="20" align="center">
												班级
											</th>
											<th height="20" align="center">
												地区
											</th>
											<th height="20" align="center">
												高考分数
											</th>
											<th height="20" align="center">
												是否报到
											</th>
											<th height="20" align="center">
												应交费用
											</th>
											<th height="20" align="center">
												欠费金额
											</th>
											<th height="20" align="center">
												科目
											</th>
											<th height="20" align="center">
												宿舍
											</th>
										</tr>

									</table>
									<!--上一页，下一页 开始-->
									<table width="100%" class="pagecss">
										<tr>
											<td align="left">
												<span id="AllPage">共几页/几条</span>
												<span id="setupNum">显示每页记录条数</span>
												<select id="setSize" onchange="ajaxChangeCount(this.options[this.options.selectedIndex].value)">
												</select>
											</td>
											<td align="right">
												<span id="Flexigrid_Bar"><a href="">上5页</a><span
													class="dan">1</span><a href="">2</a><a href="">3</a><a
													href="">下5页</a> </span>
												<span id="checkPage"><input type="text"
														style="width: 20px;"> &nbsp;页<a href="">GO</a> </span>
											</td>
										</tr>
									</table>
									<!--上一页，下一页 结束-->
									<form action="" method="post" id="export_excel_form" >
											<table width="100%" border="0" cellspacing="5" cellpadding="0">
											<tr>
												<td width="91%" align="right">
													<input type="radio" name="radio" id="radio1" value="1" onclick="setFlag(1)"
														checked="checked" />
													本页
												</td>
												<td width="9%" rowspan="2">
													<input type="button" value="导出" onclick="exportDormExcel()"/>
												</td>
											</tr>
											<tr>
												<td align="right">
													<input type="radio" name="radio" id="radio2" value="2" onclick="setFlag(0)"/>
													全部
												</td>
											</tr>
										</table>
									</form>
								</Div>
							</div>
							<!-- 表格从后台读取数据结束 -->
						</div>
					</div>
				</div>
			</div>
			<!---->

			<!---->
			<div class="condiv"
				style="width: 997px; position: relative; height: 20px; min-height: 20px; text-align: center;">
				<a href="computer/computer.html" target="_blank">计算机学院程序员之家</a>
			</div>
			<!---->

			<!--低部-->
			<div class="bottom">
				&nbsp;
			</div>
			<!---->
		</div>
		</div>
		</div>

	</body>
</html>
